﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NBusiness.VisualStudio.Commands
{
    public abstract class CommandBase : ICommand
    {
        protected virtual void Initialize() { }

        protected abstract void Execute();

        private void OnCompleted()
        {
            if (Completed != null)
                Completed(this, EventArgs.Empty);
        }

        public event EventHandler Completed;

        public virtual void Dispose() { }


        void ICommand.Execute()
        {
            Execute();
            OnCompleted();
        }

        void ICommand.Initialize()
        {
            Initialize();
        }
    }
}
